/**
 *
 */

package com.moogene.android.engine.mmi;

/**
 * @author 28849218
 */
public abstract class FTimerTask {
    int timer;
    boolean hasRun;

    public FTimerTask(int dueTime) {
        if (dueTime <= 0) {
            throw new IllegalArgumentException("dueTime should be a positive number");
        }
        timer = dueTime;
        hasRun = false;
    }

    boolean update() {
        timer--;
        if (timer <= 0) {
            run();
            hasRun = true;
        }
        return hasRun;
    }
    
    public boolean hasBeenRun(){
    	return hasRun;
    }

    public abstract void run();
}
